#include "sharelib.h"  
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ERROR_CHECK(ret, num, msg) \
    {                              \
        if (ret == num)            \
        {                          \
            perror(msg);           \
            exit(1);               \
        }                          \
    }
int searchWord(char *argv,char *wordsrc)
{
    puts(argv);
    puts(wordsrc);
    FILE *fp = fopen(argv, "r");
    char buf[128] = {0};
    int line = 0;
    char *word = NULL;
    char *p = " \t\n";
    while (fgets(buf, sizeof(buf), fp))
    {
        line++;
        puts(buf);
        word = strtok(buf, p);

        while (word != NULL)
        {
            
            if (strcmp(word, wordsrc) == 0)
            {

                printf("%d\n", line);
                fclose(fp);
                return 0;
            }
            word = strtok(NULL, p);
        }
    }
    printf("not found \n");
    fclose(fp);
    return 0;
}

